package com.itoken.server.service.impl;

import com.itoken.server.domain.SysUser;
import com.itoken.server.mapper.SysUserMapper;
import com.itoken.server.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

/**
 * Created by 蔡超 on 2019/1/19.
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public int register(SysUser sysUser) {
        return sysUserMapper.insert(sysUser);
    }

    @Override
    public SysUser login(String username, String password) {

        Example example = new Example(SysUser.class);
        example.createCriteria().andEqualTo("username",username).andEqualTo("password",password);
        return sysUserMapper.selectOneByExample(example);
    }

    @Override
    public String sayHi(String message) {
        return "hi im " + message;
    }
}
